import request from '@/utils/request.js'
import { method } from 'lodash'

//分页
export function qualityResultPages(data) {
    return request({
        url: '/result/list',
        method: 'post',
        data
    })
}

// 重新质检
export const resultReload = (data) => {
    return request({
        url: `/result/reload/${data.type}`,
        method: 'post',
        data: data['ids']
    })
}

// 下载录音
export const resultDownload = (data) => {
    return request({
        url: '/result/download',
        method: 'post',
        data: data,
    })
}
// 导出
export const resultExport = (data) => {
    return request({
        url: '/result/export',
        method: 'post',
        data,
        responseType: 'blob'//处理乱码问题，转化为blob类型
    })
}
// 质检详情
export const qualityDetail = (id) => {
    return request({
        url: `/result/${id}`,
        method: 'get'
    })
}

// 根据座席、客户侧获取标签list
export const tagList = (projectId, type) => {
    return request({
        url: `/tag/listByType/${projectId}/${type}`,
        method: 'get'
    })
}

// 新增标签
export const newTag = (data) => {
    return request({
        url: '/tag',
        method: 'post',
        data: data
    })
}

// 评分纠正
export const resultRedress = (data) => {
    return request({
        url: '/result/redress',
        method: 'post',
        data
    })
}

// 编辑质检详情
export const editQuality = (data) => {
    return request({
        url: '/result',
        method: 'put',
        data
    })
}

// 获取所有可质检id
export const resultAllId = (data) => {
    return request({
        url: '/result/allId',
        method: 'post',
        data
    })
}

// 下载对话文本
export const downloadText = (id) => {
    return request({
        url: `/result/download/${id}`,
        method: 'get',
        responseType: 'blob'//处理乱码问题，转化为blob类型
    })
}

// 获取质检项详情
export const inspection = (templateId, qualityRuleId) => {
    return request({
        url: `/qualityRule/${templateId}/${qualityRuleId}`,
        method: 'get'
    })
}
